10. Launching and Testing

Testing

Going through different parameters, understanding their implications, and testing it all out in RViz will be a challenging task. That’s why we recommend you test your implementation on a shorter path rather than the entire map.

The pose your robot starts with places it somewhere in the middle of a corridor. It is recommended that you carry out some initial tests across the length of that corridor before the robot takes a turn. This will help you figure out several aspects to improve your implementation. You can figure out if the robot gets stuck or not initially based on where it thinks are the walls with respect to its position, how quickly the robot moves and how quickly it sticks to the trajectory, and more importantly how good the PoseArray looks as the robot moves forward. Does it shrink or get worse?

You can easily carry out these tests using the 2D Nav Goal button in RViz’ toolbar, as we covered in another section.

The arrow, as indicated above, will represent the goal position, and the direction will represent the goal orientation for the robot.

The arrow, as indicated above, will represent the goal position, and the direction will represent the goal orientation for the robot.

Launching

The above method is great for testing, but for your project submission your robot needs to navigate to a specific goal position while localizing itself along the way. In the project repo we have provided you with a C++ node that will navigate the robot to the goal position for you. You will need to create a new folder for that.

$ cd /home/workspace/catkin_ws/src/udacity_bot
$ mkdir src
$ cd src

Copy the navigation_goal.cpp file to this folder.

In order to use or launch this node, you will first need to compile it. Fortunately, ROS can handle that for you. You will have to modify your CMakeLists.txt file for that.

$ cd /home/workspace/catkin_ws/src/udacity_bot

Replace this file with the file present in the repo. Then,

$ cd /home/workspace/catkin_ws
$ catkin_make
$ source devel/setup.bash

When launching the project, after you have launched udacity_world.launch and amcl.launch, in a new terminal run the following -

$ rosrun udacity_bot navigation_goal

The above will run the node, and you will notice your robot moving to the goal position.

You can also display the goal position in RViz using the “Pose” display. Try it out!

Earlier we mentioned that you could create your own RViz configuration file instead of adding different elements everytime you launched the project. In the repo we have provided you with one such file that you can add to your package.

Note: At this point, we recommend that you go through the project rubric as well. It would help you if you got familiar with some of the requirements, such as the report and any images, while tuning your parameters.,